package com.jsoft.model;

import com.jsoft.dto.BookingDto;
import com.jsoft.model.core.BaseDao;

import javax.persistence.*;

/**
 * Date: 15.08.13
 * Time: 14:47
 */

@Entity
@Table(name = "bookings")
public class BookingDao extends BaseDao {
    @Column(name = "name")
    private String name;
    @OneToOne
    @JoinColumn(name = "department_id")
    private DepartmentDao department;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public DepartmentDao getDepartment() {
        return department;
    }

    public void setDepartment(DepartmentDao department) {
        this.department = department;
    }

    public BookingDto wrapBookingDto() {
        BookingDto dto = new BookingDto();
        dto.setId(this.getObjectId());
        dto.setName(this.getName());
        return dto;
    }

    public BookingDao wrapBookingDao(BookingDto dto) {
        BookingDao dao = new BookingDao();
        dao.setName(dto.getName());
        return dao;
    }
}
